package com.kyubi.common.data;

import java.util.HashMap;
import java.util.Set;
import java.util.Vector;

public class Instances {

	// Map to store meta information
	private HashMap<String, String> metadata;
	
	// List of data
	private Vector<String> data;
	// Class values
	private Vector<Boolean> labels;

	public Instances() {
		metadata = new HashMap<String, String>();
		data = new Vector<String>();
		labels = new Vector<Boolean>();
	}
	
	public void addData(String txt) {
		data.add(txt);
	}
	
	public void addLabel(boolean l) {
		labels.add(l);
	}
	
	public String getDataAt(int index) {
		if(index < data.size()) {
			return data.get(index);
		} else {
			return null;
		}
	}
	
	public boolean getLabelAt(int index) {
		if(index < labels.size()) {
			return labels.get(index);
		} else {
			return false;
		}
	}
	
	public Vector<String> getData() {
		return data;
	}
	
	public Vector<Boolean> getLabels() {
		return labels;
	}
	
	public String getMetaData(String key) {
		if(metadata.containsKey(key)) {
			return metadata.get(key);
		} else {
			return null;
		}
	}
	
	public Set<String> getMetaKeys() {
		return metadata.keySet();
	}
	
	public int size() {
		return data.size();
	}
}
